package si.wasu.trik;

import si.wasu.drawable.CanvasView;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.Spinner;

public class MainActivity extends Activity {
	CanvasView canvasView;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
		String selected=String.valueOf(LevelListener.level);
		int level=Integer.parseInt(selected.split(" ")[1]);
		if(level==LevelListener.zadnjiZGumbom) {
			LevelListener.konec=true;
		}
		else {
			LevelListener.konec=false;
		}
		
		canvasView = new CanvasView(this,level);
		canvasView.setBackgroundResource(R.drawable.ozadje2);
//		canvasView.setBackgroundColor(Color.rgb(210, 230, 255));
		
        setContentView(canvasView);
	}

	/*@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}*/
	
	
	
	@Override
	public void onBackPressed() {
		// TODO Auto-generated method stub
		super.onBackPressed();
		Intent intent = new Intent(this, MenuActivity.class);
		startActivity(intent);
	}

	public void showPause() {
		canvasView.setDrawing(false);
		canvasView.destroyDrawingCache();
		canvasView=null;
		System.gc();
		Intent intent = new Intent(this, Pavza.class);
		startActivity(intent);
	}

}
